<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>添加文章</title>
<link href="${base}/resources/admin/css/amazeui.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />

</head>
<body>
	<div class="path">
		<a href="${base}/asl-admin/common/index.htm">${message("admin.path.index")}</a> &raquo; 添加文章
	</div>
	<form id="inputForm" action="save.htm" method="post">
		<table class="input">
            <tr>
                <th>
                    <span class="requiredField">*</span>作者:
                </th>
                <td>
                    <select name="memberId" data-am-selected="{searchBox: 1}" >
					[#list members as m ]
                        [#if m.type="teacher"]
                            <option value="${m.id}" >${m.username}[#if m.name]（${m.name}）[/#if]</option>
                        [/#if]
					[/#list]
                    </select>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="requiredField">*</span>分类:
                </th>
                <td>
                    <select name="categoryId" >
                    [#list categories as category ]
                        <option value="${category.id}" >${category.name}</option>
                    [/#list]
                    </select>
                </td>
            </tr>
            <tr>
                <th>
                    文章封面:
                </th>
                <td>
					<span class="fieldSet">
						<input type="text" name="imageURL" class="text" maxlength="200" title="${message("admin.imageTitle")}" />
						<input type="button" id="browserButton" class="button" value="${message("admin.browser.select")}" />
					</span>
                </td>
            </tr>
			<tr>
				<th>
					<span class="requiredField">*</span>标题:
				</th>
				<td>
					<input type="text" name="title" class="text" maxlength="200" placeholder="请输入文章标题"/>
				</td>
			</tr>
            <tr>
                <th>
                    <span class="requiredField">*</span>内容:
                </th>
                <td>
                    <textarea id="essayContent" name="content" class="editor" style="width: 750px;"></textarea>
                </td>
            </tr>
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="${message("admin.common.submit")}" />
					<input type="button" class="button" value="${message("admin.common.back")}" onclick="location.href='list.htm'" />
				</td>
			</tr>
		</table>
	</form>
</body>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.tools.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/amazeui.min.js"></script>
<script type="text/javascript" src="${base}/resources/admin/editor/kindeditor.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
<script type="text/javascript">
    $().ready(function() {

        var $inputForm = $("#inputForm");
        var $browserButton = $("#browserButton");

    [@flash_message /]

        $browserButton.browser();

        // 表单验证
        $inputForm.validate({
            rules: {
                title: "required",
                memberId:"required",
                content: "required",
                categoryId :"required"
            }
        });

        //编辑器
        if(typeof(KindEditor) != "undefined") {
            KindEditor.ready(function(K) {
                editor = K.create("#essayContent", {
                    height: "700px",
                    items: [
                        "source", "|", "undo", "redo", "|", "preview", "print", "template", "cut", "copy", "paste",
                        "plainpaste", "wordpaste", "|", "justifyleft", "justifycenter", "justifyright",
                        "justifyfull", "insertorderedlist", "insertunorderedlist", "indent", "outdent", "subscript",
                        "superscript", "clearhtml", "quickformat", "selectall", "|", "fullscreen", "/",
                        "formatblock", "fontname", "fontsize", "|", "forecolor", "hilitecolor", "bold",
                        "italic", "underline", "strikethrough", "lineheight", "removeformat", "|", "image",
                        "insertfile", "table", "hr", "emoticons", "baidumap", "pagebreak",
                        "anchor", "link", "unlink"
                    ],
                    langType: system.locale,
                    syncType: "form",
                    filterMode: false,
                    pagebreakHtml: '<hr class="pageBreak" \/>',
                    allowFileManager: true,
                    filePostName: "file",
                    fileManagerJson: system.base + "/asl-admin/file/browser.action",
                    uploadJson: system.base + "/asl-admin/file/upload.action",
                    uploadImageExtension: setting.uploadImageExtension,
                    uploadFlashExtension: setting.uploadFlashExtension,
                    uploadMediaExtension: setting.uploadMediaExtension,
                    uploadFileExtension: setting.uploadFileExtension,
                    extraFileUploadParams: {
                        token: getCookie("token")
                    },
                    afterChange: function() {
                        this.sync();
                    }
                });
            });
        }

    });
</script>
</html>
